package com.google.android.gms.internal;

import java.io.IOException;

public final class zzjn extends zzflm<zzjn> {
    private zzju zzbev = null;
    private Integer zzbew = null;
    private zzjl zzbex = null;
    private zzjt[] zzbey = zzjt.zzhw();

    public zzjn() {
        this.zzpvl = null;
        this.zzpnr = -1;
    }

    /* access modifiers changed from: private */
    /* renamed from: zzp */
    public final zzjn zza(zzflj zzflj) throws IOException {
        zzfls zzfls;
        while (true) {
            int zzcxx = zzflj.zzcxx();
            if (zzcxx == 0) {
                return this;
            }
            if (zzcxx == 10) {
                if (this.zzbex == null) {
                    this.zzbex = new zzjl();
                }
                zzfls = this.zzbex;
            } else if (zzcxx == 18) {
                int zzb = zzflv.zzb(zzflj, 18);
                int length = this.zzbey == null ? 0 : this.zzbey.length;
                zzjt[] zzjtArr = new zzjt[(zzb + length)];
                if (length != 0) {
                    System.arraycopy(this.zzbey, 0, zzjtArr, 0, length);
                }
                while (length < zzjtArr.length - 1) {
                    zzjtArr[length] = new zzjt();
                    zzflj.zza(zzjtArr[length]);
                    zzflj.zzcxx();
                    length++;
                }
                zzjtArr[length] = new zzjt();
                zzflj.zza(zzjtArr[length]);
                this.zzbey = zzjtArr;
            } else if (zzcxx == 24) {
                int position = zzflj.getPosition();
                try {
                    this.zzbew = Integer.valueOf(zzjc.zzd(zzflj.zzcym()));
                } catch (IllegalArgumentException unused) {
                    zzflj.zzmw(position);
                    zza(zzflj, zzcxx);
                }
            } else if (zzcxx == 34) {
                if (this.zzbev == null) {
                    this.zzbev = new zzju();
                }
                zzfls = this.zzbev;
            } else if (!super.zza(zzflj, zzcxx)) {
                return this;
            }
            zzflj.zza(zzfls);
        }
    }

    public final void zza(zzflk zzflk) throws IOException {
        if (this.zzbex != null) {
            zzflk.zza(1, (zzfls) this.zzbex);
        }
        if (this.zzbey != null && this.zzbey.length > 0) {
            for (zzjt zzjt : this.zzbey) {
                if (zzjt != null) {
                    zzflk.zza(2, (zzfls) zzjt);
                }
            }
        }
        if (this.zzbew != null) {
            zzflk.zzad(3, this.zzbew.intValue());
        }
        if (this.zzbev != null) {
            zzflk.zza(4, (zzfls) this.zzbev);
        }
        super.zza(zzflk);
    }

    /* access modifiers changed from: protected */
    public final int zzq() {
        int zzq = super.zzq();
        if (this.zzbex != null) {
            zzq += zzflk.zzb(1, (zzfls) this.zzbex);
        }
        if (this.zzbey != null && this.zzbey.length > 0) {
            for (zzjt zzjt : this.zzbey) {
                if (zzjt != null) {
                    zzq += zzflk.zzb(2, (zzfls) zzjt);
                }
            }
        }
        if (this.zzbew != null) {
            zzq += zzflk.zzag(3, this.zzbew.intValue());
        }
        return this.zzbev != null ? zzq + zzflk.zzb(4, (zzfls) this.zzbev) : zzq;
    }
}
